/* ==========================================================================
   FOLHA DE ESTILOS MESTRE - PONTUALIDADE OPERACIONAL
   Importa variáveis de tema e regras fundamentais do index.css
   ========================================================================== */
@import url("index.css");

/* ==========================================================================
   1. ESTRUTURA GLOBAL E TRAVAMENTO DE JANELA
   Trava o body na altura da tela (100vh) para que o topo fique fixo
   ========================================================================== */
html, body {
  height: 100vh;           /* Força ocupação exata de 100% da altura da janela */
  width: 100vw;            /* Força ocupação exata de 100% da largura da janela */
  margin: 0;
  padding: 0;
  overflow: hidden;        /* Elimina barra de rolagem geral na janela do navegador */
  display: flex;
  flex-direction: column;  /* Organização vertical: Header -> Filtros -> KPIs -> Conteúdo */
  box-sizing: border-box;
}

/* ==========================================================================
   2. BARRA SUPERIOR DE NAVEGAÇÃO (HEADER FIXO)
   ========================================================================== */
.top-nav {
  flex-shrink: 0;                          /* Não encolhe ao rolar a página */
  z-index: 30;                             /* Fica sobreposto a outros elementos */
  display: flex;
  justify-content: space-between;          /* Título à esquerda, controles à direita */
  align-items: center;
  padding: 0.75rem 1.5rem;
  background-color: var(--topbar-bg);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);             /* Efeito fosco moderno */
  -webkit-backdrop-filter: blur(12px);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Botão Home de Retorno */
.home-btn {
  text-decoration: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.home-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);             /* Leve elevação ao passar o mouse */
}

/* Título e Ícone da Página */
.page-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.page-title i {
  color: var(--primary);
  font-size: 1.4rem;
}

/* ==========================================================================
   3. BARRA DE FILTROS HORIZONTAL (LINHA ÚNICA NO TOPO)
   ========================================================================== */
.top-filters-bar {
  flex-shrink: 0;
  z-index: 25;
  display: flex;
  align-items: flex-end;                   /* Alinha inputs e botões pela base */
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;                                 /* Distribui a largura igualmente entre os filtros */
  min-width: 110px;
}

.filter-item label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: uppercase;               /* Rótulos em caixa alta para padronização */
  letter-spacing: 0.5px;
}

/* Estilo unificado para Selects e Inputs da barra de filtros */
.filter-item select,
.filter-item input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-item select {
  cursor: pointer;
}

.filter-item input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.filter-item select:focus,
.filter-item input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.filter-actions {
  display: flex;
  align-items: flex-end;
}

/* Botão Limpar Filtros */
.btn-clear {
  height: 36px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-clear:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   FILTRO DE PERÍODO ESTILO POWER BI (CALENDÁRIO DUPLO + LINHA DO TEMPO)
   ========================================================================== */
.period-filter-item {
  min-width: 250px !important;
  flex: 1.4 !important;
}

.period-picker-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.period-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.period-inputs input[type="date"] {
  height: 32px !important;
  padding: 0 0.45rem !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  color: var(--text-main) !important;
  background: var(--bg-color) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  outline: none;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.period-separator {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Linha do Tempo Deslizante com Dois Controles (Power BI Timeline Slider) */
.range-slider-timeline {
  position: relative;
  width: 100%;
  height: 10px;
  display: flex;
  align-items: center;
  margin-top: 0.1rem;
}

.range-slider-timeline input[type="range"] {
  position: absolute;
  width: 100%;
  height: 4px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  z-index: 5;
}

/* Trilho de Fundo */
.range-slider-timeline::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  z-index: 1;
}

[data-theme="light"] .range-slider-timeline::before {
  background: rgba(0, 0, 0, 0.15);
}

/* Preenchimento Azul do Intervalo Selecionado */
.slider-track-highlight {
  position: absolute;
  height: 4px;
  background: var(--primary);
  border-radius: 2px;
  z-index: 2;
  pointer-events: none;
}

/* Manípulos Deslizantes (Thumbs) */
.range-slider-timeline input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-main);
  border: 2px solid var(--primary);
  cursor: ew-resize;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
}

.range-slider-timeline input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.range-slider-timeline input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-main);
  border: 2px solid var(--primary);
  cursor: ew-resize;
}

/* ==========================================================================
   4. SEÇÃO FIXA DOS CARTÕES KPIS (6 OU 7 COLUNAS)
   ========================================================================== */
.kpis-fixed-wrapper {
  flex-shrink: 0;
  z-index: 20;
  padding: 0.75rem 1.5rem;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
}

/* Grade Padrão para 6 Cartões */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}

/* Grade Específica para 7 Cartões em Linha Única */
.kpis-grid-7 {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  gap: 0.65rem !important;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpis-grid-7 .kpi-card {
  padding: 0.75rem 0.85rem !important;
  gap: 0.75rem !important;
}

/* Ícones dos Cartões */
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.kpis-grid-7 .kpi-icon {
  width: 38px !important;
  height: 38px !important;
  font-size: 1.25rem !important;
}

/* Cores Padronizadas dos Ícones dos Cartões */
.kpi-icon.blue   { background: rgba(59, 130, 246, 0.15) !important; color: #3b82f6 !important; }
.kpi-icon.cyan   { background: rgba(6, 182, 212, 0.15)  !important; color: #06b6d4 !important; }
.kpi-icon.green  { background: rgba(34, 197, 94, 0.15)  !important; color: #22c55e !important; }
.kpi-icon.red    { background: rgba(239, 68, 68, 0.15)  !important; color: #ef4444 !important; }
.kpi-icon.yellow { background: rgba(234, 179, 8, 0.15)  !important; color: #eab308 !important; }
.kpi-icon.orange { background: rgba(249, 115, 22, 0.15) !important; color: #f97316 !important; }
.kpi-icon.purple { background: rgba(168, 85, 247, 0.15) !important; color: #a855f7 !important; }

/* Destaques de Bordas Iluminadas nos Cartões de Índices */
.kpi-card.highlight-green  { border-color: rgba(34, 197, 94, 0.45) !important; box-shadow: 0 0 15px rgba(34, 197, 94, 0.1) !important; }
.kpi-card.highlight-red    { border-color: rgba(239, 68, 68, 0.45) !important; box-shadow: 0 0 15px rgba(239, 68, 68, 0.1) !important; }
.kpi-card.highlight-orange { border-color: rgba(249, 115, 22, 0.45) !important; box-shadow: 0 0 15px rgba(249, 115, 22, 0.1) !important; }
.kpi-card.highlight        { border-color: rgba(168, 85, 247, 0.45) !important; box-shadow: 0 0 15px rgba(168, 85, 247, 0.1) !important; }

.kpi-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.kpi-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================================================
   5. ÁREA ROLÁVEL PRINCIPAL (TABELA + GRÁFICOS INFERIORES)
   ========================================================================== */
.dashboard-scrollable-area {
  flex: 1;                                 /* Preenche todo o espaço vertical restante */
  overflow-y: auto;                        /* Habilita rolagem vertical contínua */
  overflow-x: hidden;
  padding: 1.25rem 1.5rem 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-sizing: border-box;
  scrollbar-width: thin;
}

/* ==========================================================================
   6. TABELA DE REGISTROS E TOOLBAR SUPERIOR
   ========================================================================== */
.table-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.table-toolbar {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 1rem !important;
  flex-wrap: nowrap !important;
}

.toolbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 1.25rem !important;
}

.toolbar-left h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

/* Checkbox no Título da Tabela (Filtro Exclusivo) */
.checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background: var(--bg-color);
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.checkbox-container:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.checkbox-container input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
}

/* Lado Direito da Toolbar (Hora Motorista, Tolerância e Colunas) */
.toolbar-right {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.65rem !important;
  flex-wrap: nowrap !important;
}

.toolbar-input-group,
.btn-secondary {
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

.toolbar-input-group {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 0 0.65rem;
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.toolbar-input-group label {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.toolbar-input-group input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.82rem;
  outline: none;
  text-align: center;
  width: 75px;
}

.toolbar-input-group input[type="number"] {
  width: 40px;
}

.toolbar-input-group .unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-secondary {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  gap: 0.4rem;
}

/* ==========================================================================
   7. MENU FLUTUANTE DE COLUNAS (FUNDO 100% SÓLIDO E OPACO)
   ========================================================================== */
.column-visibility-dropdown {
  position: relative;
}

.column-menu {
  position: absolute;
  right: 0;
  top: 115%;
  background-color: #121a2b;               /* Fundo 100% sólido escuro */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.85rem;
  display: none;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 100;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  min-width: 200px;
}

[data-theme="light"] .column-menu {
  background-color: #ffffff;               /* Fundo 100% branco no Modo Claro */
  border-color: #cbd5e1;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.column-menu.show {
  display: flex;
}

.column-menu label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.column-menu label:hover {
  color: var(--primary);
}

/* ==========================================================================
   8. CONTAINER, TABELA E CABEÇALHOS CENTRALIZADOS
   ========================================================================== */
.table-container {
  overflow-x: hidden !important;           /* Sem barra horizontal */
  overflow-y: hidden !important;           /* Sem barra vertical */
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

table {
  width: 100% !important;
  border-collapse: collapse;
  table-layout: auto !important;
  font-size: 0.78rem;
  text-align: center;
}

th, td {
  padding: 0.45rem 0.2rem !important;
  border-bottom: 1px solid var(--border-color);
  text-align: center !important;
  vertical-align: middle !important;
}

td {
  font-size: 0.75rem !important;
  white-space: nowrap !important;          /* Dados da linha em linha única */
}

/* Cabeçalho com Quebra de Texto Obrigatória e Tamanho Compacto */
th {
  background-color: #141d2f;               /* Sólido no Modo Escuro */
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.70rem !important;           /* Fonte padrão compacta */
  text-transform: uppercase;
  letter-spacing: normal !important;
  white-space: normal !important;          /* Força quebra de linha nas palavras */
  word-break: normal !important;
  overflow-wrap: normal !important;
  text-wrap: balance !important;           /* Distribuição harmônica das palavras */
  line-height: 1.15 !important;
  max-width: 80px !important;              /* Limite para evitar expansão lateral */
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] th {
  background-color: #e2e8f0;               /* Sólido no Modo Claro */
  color: #1e293b;
  border-bottom: 2px solid #cbd5e1;
}

tbody tr {
  cursor: context-menu;                    /* Indica clique com botão direito */
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}

.hora-vazia {
  color: var(--text-muted);
  font-weight: 600;
  opacity: 0.6;
}

.tempo-excedido {
  color: #ef4444 !important;               /* Destaque em vermelho para tempo de viagem > 5 min */
  font-weight: 800 !important;
}

/* ==========================================================================
   9. BADGES DE STATUS E SITUAÇÃO OPERACIONAL
   ========================================================================== */
.badge {
  padding: 0.18rem 0.35rem !important;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.68rem !important;
  display: inline-block;
}

.badge.pontual       { background: rgba(34, 197, 94, 0.15)  !important; color: #22c55e !important; }
.badge.atrasado      { background: rgba(239, 68, 68, 0.15)  !important; color: #ef4444 !important; }
.badge.adiantado     { background: rgba(59, 130, 246, 0.15) !important; color: #3b82f6 !important; } /* Azul */
.badge.nao_realizado { background: rgba(148, 163, 184, 0.2) !important; color: #94a3b8 !important; }
.badge.purple-badge  { background: rgba(168, 85, 247, 0.15) !important; color: #a855f7 !important; }
.badge.conforme      { background: rgba(34, 197, 94, 0.15)  !important; color: #22c55e !important; }
.badge.moderado      { background: rgba(234, 179, 8, 0.2)   !important; color: #eab308 !important; border: 1px solid rgba(234, 179, 8, 0.5); }
.badge.grave         { background: rgba(249, 115, 22, 0.2)  !important; color: #f97316 !important; border: 1px solid rgba(249, 115, 22, 0.5); }

/* Animação Vermelha Pulsante (Excedente e Gravíssimo) */
@keyframes pulseRed {
  0%   { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.75); }
  70%  { transform: scale(1.03); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.badge.excedente {
  background-color: rgba(239, 68, 68, 0.25) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.5);
  animation: pulseRed 1.8s infinite;
  font-weight: 800;
}

.badge.gravissimo {
  background-color: rgba(239, 68, 68, 0.25) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.6);
  font-weight: 800;
  animation: pulseRed 1.8s infinite;
}

.badge-situacao {
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.badge-situacao:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

/* ==========================================================================
   10. DIGITAÇÃO INLINE, MENU DE CONTEXTO E JANELAS MODAIS
   ========================================================================== */
.input-inline-hora {
  width: 65px;
  height: 26px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  outline: none;
  padding: 0 0.2rem;
  transition: all 0.2s ease;
}

.input-inline-hora:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  background: var(--bg-card);
}

/* Menu de Botão Direito */
.custom-context-menu {
  position: fixed;
  background-color: #121a2b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  padding: 0.4rem;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 1000;
  min-width: 190px;
}

[data-theme="light"] .custom-context-menu {
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.custom-context-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.82rem;
  color: var(--text-main);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.custom-context-menu .menu-item:hover {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.custom-context-menu .menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Estrutura das Modais (Ajustada para 3 Colunas Perfeitas) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 90%;
  max-width: 520px; /* Largura ideal para acomodar 3 colunas perfeitamente */
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.modal-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0 !important; /* Impede que o campo ultrapasse os limites do grid */
  width: 100%;
}

.modal-input-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.modal-input-group input {
  height: 38px;
  width: 100% !important;
  min-width: 0 !important; /* Impede vazamento no CSS Grid */
  box-sizing: border-box;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 8px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  outline: none;
}

.modal-input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.modal-footer-right {
  display: flex;
  gap: 0.5rem;
}

.btn-modal-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.btn-modal-secondary {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}

.btn-modal-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

/* ==========================================================================
   11. RODAPÉ DA TABELA (PAGINAÇÃO EM 3 BLOCOS)
   ========================================================================= */
.pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 0.35rem;
  flex-shrink: 0;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-left input {
  width: 55px;
  height: 30px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  padding: 0 0.4rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
  outline: none;
}

.footer-left input:focus {
  border-color: var(--primary);
}

.footer-center {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-pagination {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.80rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-pagination:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.footer-right strong {
  color: var(--text-main);
}

/* ==========================================================================
   12. SEÇÕES E GRADES DE GRÁFICOS (100% LARGURA, 3 COLUNAS OU EMPILHADOS)
   ========================================================================== */
.chart-full-width-section {
  width: 100%;
  margin-top: 0.5rem;
}

.chart-full-width-section .chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chart-full-width-section .chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-full-width-section .chart-header h3 {
  font-size: 0.98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-main);
}

.chart-badge-data {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.charts-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.3fr;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.charts-bottom-grid .chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.charts-bottom-grid .chart-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-main);
}

.charts-bottom-grid .chart-body,
.charts-vertical-stack .chart-body {
  position: relative;
  height: 290px;
  width: 100%;
}

.charts-vertical-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  margin-top: 0.5rem;
  padding-bottom: 2.5rem;
}

.charts-vertical-stack .chart-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.charts-vertical-stack .chart-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-main);
}

/* ==========================================================================
   13. RESPONSIVIDADE E TELAS MENORES
   ========================================================================== */
@media (max-width: 1400px) {
  .kpis-grid-7 {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
  }
}

@media (max-width: 1200px) {
  .charts-bottom-grid {
    grid-template-columns: 1fr;
  }
}

.kpis-grid-8 {
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  gap: 0.55rem !important;
}

.kpis-grid-8 .kpi-card {
  padding: 0.65rem 0.75rem !important;
  gap: 0.65rem !important;
}

.kpis-grid-8 .kpi-icon {
  width: 36px !important;
  height: 36px !important;
  font-size: 1.2rem !important;
}

.kpis-grid-8 .kpi-label {
  font-size: 0.68rem !important;
  white-space: nowrap !important;
}

.kpis-grid-8 .kpi-value {
  font-size: 1.15rem !important;
}

@media (max-width: 1550px) {
  .kpis-grid-8 {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
  }
}

.btn-param-toggle {
  font-weight: 700 !important;
  transition: all 0.2s ease !important;
}

.btn-param-toggle.salvar {
  background-color: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4) !important;
}

.toolbar-input-group input:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.mini-situacao-cards {
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
}

.mini-card-sit {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  padding: 0.25rem 0.65rem !important;
  border-radius: 6px !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  user-select: none;
}

.mini-card-sit strong {
  font-weight: 800 !important;
  font-size: 0.82rem !important;
  margin-left: 2px !important;
}

.mini-card-sit.gravissimo {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}
.mini-card-sit.gravissimo strong {
  color: #ef4444 !important;
}

.mini-card-sit.grave {
  background: rgba(249, 115, 22, 0.18) !important;
  color: #f97316 !important;
  border: 1px solid rgba(249, 115, 22, 0.4) !important;
}
.mini-card-sit.grave strong {
  color: #f97316 !important;
}

.mini-card-sit.moderado {
  background: rgba(234, 179, 8, 0.18) !important;
  color: #eab308 !important;
  border: 1px solid rgba(234, 179, 8, 0.4) !important;
}
.mini-card-sit.moderado strong {
  color: #eab308 !important;
}

.mini-card-sit.normal {
  background: rgba(34, 197, 94, 0.18) !important;
  color: #22c55e !important;
  border: 1px solid rgba(34, 197, 94, 0.4) !important;
}
.mini-card-sit.normal strong {
  color: #22c55e !important;
}

.company-param-toggle {
  display: inline-flex;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.btn-company-param {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-company-param.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

.btn-company-param:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.mini-card-sit.atraso-garagem {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}
.mini-card-sit.atraso-garagem strong {
  color: #ef4444 !important;
}

.mini-card-sit.atraso-ocioso {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #3b82f6 !important;
  border: 1px solid rgba(59, 130, 246, 0.4) !important;
}
.mini-card-sit.atraso-ocioso strong {
  color: #3b82f6 !important;
}

.mini-card-sit.atraso-terminal {
  background: rgba(168, 85, 247, 0.18) !important;
  color: #a855f7 !important;
  border: 1px solid rgba(168, 85, 247, 0.4) !important;
}
.mini-card-sit.atraso-terminal strong {
  color: #a855f7 !important;
}

/* Ícone e Cursor de Ordenação nas Colunas */
th.sortable {
  cursor: pointer !important;
  user-select: none;
  transition: background-color 0.2s ease;
}
th.sortable:hover {
  background-color: rgba(59, 130, 246, 0.15) !important;
  color: var(--primary) !important;
}
th .sort-icon {
  margin-left: 4px;
  font-size: 0.75rem;
  vertical-align: middle;
  opacity: 0.4;
}
th.sorted .sort-icon {
  opacity: 1;
  color: var(--primary);
}